import request from "../../../../utils/request";
import Vue from "vue";
export const service = () => {
  console.log(Vue.$store);
  return Vue.$store && Vue.$store.getters.userInfo.tenantId
    ? "/device"
    : "ttdevice";
};
export const servic = () => {
  return !!JSON.parse(localStorage.$loginInfo).tenantId ? "/event" : "/ttevent";
};

const device = "/device";
const ttdevice = "/ttdevice";
const system = "/admin";
const order = "/order";
const video = "video-video";

// 铁塔账号 关键字查询租户
export function queryTenantInfo(query) {
  return request({
    url: system + "/custom/manage/queryTenantInfo",
    method: "post",
    data: query,
  });
}

export function getDeviceList(query) {
  return request({
    url: service() + "/video/device/getDeviceList",
    method: "post",
    data: query,
  });
}

export function queryTenant(query) {
  return request({
    url: system + "/system/tenant/list",
    method: "post",
    data: query,
  });
}

export function getRegion(query) {
  return request({
    url: "/admin/video/getRegion",
    method: "post",
    data: query,
  });
}

export function findOrderAlarm(query) {
  return request({
    url: servic() + "/alarm/type/findOrderAlarm",
    method: "post",
    data: query,
  });
}

export function getOrderList(query) {
  return request({
    url: servic() + "/alarm/order/getOrderList",
    method: "post",
    data: query,
  });
}
